package com.orange.core.pojo.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Arrays;
import java.util.List;

/**
 * 用户类型
 */
@AllArgsConstructor
@Getter
public enum EUserType implements IDict {

    USER(1, "用户"),

    EMPLOYEE(2, "员工"),

    MERCHANT(3, "商管"),
    ;

    private final int value;
    private final String label;

    public static final List<Integer> EMPLOYEE_TYPES = Arrays.asList(
            EMPLOYEE.value,
            MERCHANT.value
    );

    public static EUserType getByValue(int value) {
        for (EUserType type : EUserType.values()) {
            if (type.value == value) {
                return type;
            }
        }
        throw new IllegalArgumentException("用户类型" + value + "不存在");
    }
}
